﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable disable

namespace Model.Models
{
    public partial class gmdbContext : DbContext, IgmdbContext
    {
        public gmdbContext()
        {
        }

        public gmdbContext(DbContextOptions<gmdbContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Bill> Bills { get; set; }
        public virtual DbSet<Company> Companies { get; set; }
        public virtual DbSet<Consume> Consumes { get; set; }
        public virtual DbSet<Consumetype> Consumetypes { get; set; }
        public virtual DbSet<SysDict> SysDicts { get; set; }
        public virtual DbSet<User> Users { get; set; }

//        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
//        {
//            if (!optionsBuilder.IsConfigured)
//            {
//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
//                optionsBuilder.UseMySql("server=localhost;userid=root;pwd=root;port=3306;database=gmdb;sslmode=none", Microsoft.EntityFrameworkCore.ServerVersion.Parse("5.7.26-mysql"));
//            }
//        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasCharSet("utf8mb4")
                .UseCollation("utf8mb4_general_ci");

            modelBuilder.Entity<Bill>(entity =>
            {
                entity.ToTable("bill");

                entity.Property(e => e.Id).HasMaxLength(100);

                entity.Property(e => e.AlipayName).HasMaxLength(200);

                entity.Property(e => e.AlipayNo).HasMaxLength(200);

                entity.Property(e => e.AmountEarned).HasPrecision(12, 2);

                entity.Property(e => e.BookDate)
                    .HasColumnType("datetime")
                    .HasColumnName("bookDate");

                entity.Property(e => e.Classification).HasMaxLength(100);

                entity.Property(e => e.CommissionRate).HasPrecision(12, 2);

                entity.Property(e => e.CompanyId)
                    .HasMaxLength(10)
                    .HasColumnName("companyId")
                    .IsFixedLength(true);

                entity.Property(e => e.Consignee).HasMaxLength(200);

                entity.Property(e => e.ConsigneeAdress).HasMaxLength(200);

                entity.Property(e => e.ConsigneeTel).HasMaxLength(200);

                entity.Property(e => e.CourierCompany).HasMaxLength(200);

                entity.Property(e => e.CourierNo).HasMaxLength(200);

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("create_time");

                entity.Property(e => e.CreateUser)
                    .HasMaxLength(200)
                    .HasColumnName("create_user");

                entity.Property(e => e.MoutaiNo).HasMaxLength(200);

                entity.Property(e => e.OrderNo)
                    .HasMaxLength(100)
                    .HasColumnName("orderNo");

                entity.Property(e => e.OrderNum)
                    .HasColumnType("int(11)")
                    .HasColumnName("orderNum");

                entity.Property(e => e.OrderUser).HasMaxLength(100);

                entity.Property(e => e.PaymentAmount).HasPrecision(12, 2);

                entity.Property(e => e.PaymentMethod).HasMaxLength(100);

                entity.Property(e => e.PlanReceiveDate).HasColumnType("datetime");

                entity.Property(e => e.Platform).HasMaxLength(200);

                entity.Property(e => e.Programme).HasColumnName("programme");

                entity.Property(e => e.RebateAmount).HasPrecision(12, 2);

                entity.Property(e => e.ReceiveDate).HasColumnType("datetime");

                entity.Property(e => e.RefundAmount).HasPrecision(12, 2);

                entity.Property(e => e.Remark).HasColumnName("remark");

                entity.Property(e => e.Sender).HasMaxLength(200);

                entity.Property(e => e.Settlement).HasMaxLength(200);

                entity.Property(e => e.Specification).HasMaxLength(200);

                entity.Property(e => e.State)
                    .HasMaxLength(100)
                    .HasColumnName("state");

                entity.Property(e => e.Type)
                    .HasMaxLength(100)
                    .HasColumnName("type");

                entity.Property(e => e.TypeId).HasMaxLength(100);

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("update_time");

                entity.Property(e => e.UpdateUser)
                    .HasMaxLength(200)
                    .HasColumnName("update_user");

                entity.Property(e => e.WechatName).HasMaxLength(200);

                entity.Property(e => e.WechatNo).HasMaxLength(200);
            });

            modelBuilder.Entity<Company>(entity =>
            {
                entity.ToTable("company");

                entity.Property(e => e.CompanyId).HasMaxLength(50);

                entity.Property(e => e.Address)
                    .HasMaxLength(100)
                    .HasColumnName("address");

                entity.Property(e => e.CompanCcode).HasMaxLength(100);

                entity.Property(e => e.CompanyName).HasMaxLength(200);

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("create_time");

                entity.Property(e => e.CreateUser)
                    .HasMaxLength(200)
                    .HasColumnName("create_user");

                entity.Property(e => e.Delflage)
                    .HasColumnType("int(11)")
                    .HasColumnName("delflage");

                entity.Property(e => e.Email)
                    .HasMaxLength(200)
                    .HasColumnName("email");

                entity.Property(e => e.Integral)
                    .HasColumnType("int(11)")
                    .HasColumnName("integral");

                entity.Property(e => e.Mobile)
                    .HasMaxLength(100)
                    .HasColumnName("mobile");

                entity.Property(e => e.Photo)
                    .HasMaxLength(1000)
                    .HasColumnName("photo");

                entity.Property(e => e.Qrcode)
                    .HasMaxLength(64)
                    .HasColumnName("qrcode");

                entity.Property(e => e.Status)
                    .HasMaxLength(1)
                    .HasColumnName("status");

                entity.Property(e => e.Type)
                    .HasMaxLength(50)
                    .HasColumnName("type");

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("update_time");

                entity.Property(e => e.UpdateUser)
                    .HasMaxLength(200)
                    .HasColumnName("update_user");
            });

            modelBuilder.Entity<Consume>(entity =>
            {
                entity.ToTable("consume");

                entity.Property(e => e.Id).HasMaxLength(100);

                entity.Property(e => e.Commission).HasPrecision(12);

                entity.Property(e => e.CommissionRate).HasPrecision(12);

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("create_time");

                entity.Property(e => e.CreateUser)
                    .HasMaxLength(200)
                    .HasColumnName("create_user");

                entity.Property(e => e.Mome).HasMaxLength(100);

                entity.Property(e => e.Money).HasPrecision(12);

                entity.Property(e => e.OrderNo)
                    .HasMaxLength(100)
                    .HasColumnName("orderNo");

                entity.Property(e => e.PaymentDate).HasMaxLength(100);

                entity.Property(e => e.Principal).HasPrecision(12);

                entity.Property(e => e.Remark)
                    .HasMaxLength(100)
                    .HasColumnName("remark");

                entity.Property(e => e.Type)
                    .HasMaxLength(100)
                    .HasColumnName("type");

                entity.Property(e => e.TypeId).HasMaxLength(100);

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("update_time");

                entity.Property(e => e.UpdateUser)
                    .HasMaxLength(200)
                    .HasColumnName("update_user");
            });

            modelBuilder.Entity<Consumetype>(entity =>
            {
                entity.ToTable("consumetype");

                entity.HasComment("收支类型，如’食品‘，’工资‘等");

                entity.Property(e => e.Id)
                    .HasMaxLength(100)
                    .HasColumnName("id");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("create_time");

                entity.Property(e => e.CreateUser)
                    .HasMaxLength(200)
                    .HasColumnName("create_user");

                entity.Property(e => e.Icon)
                    .HasMaxLength(100)
                    .HasColumnName("icon");

                entity.Property(e => e.Name)
                    .HasMaxLength(100)
                    .HasColumnName("name");

                entity.Property(e => e.Remark)
                    .HasMaxLength(100)
                    .HasColumnName("remark");

                entity.Property(e => e.Type)
                    .HasMaxLength(100)
                    .HasColumnName("type");

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("update_time");

                entity.Property(e => e.UpdateUser)
                    .HasMaxLength(200)
                    .HasColumnName("update_user");
            });

            modelBuilder.Entity<SysDict>(entity =>
            {
                entity.HasKey(e => e.DictCode)
                    .HasName("PRIMARY");

                entity.ToTable("sys_dict");

                entity.Property(e => e.DictCode)
                    .HasMaxLength(100)
                    .HasColumnName("dict_code");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("create_time");

                entity.Property(e => e.CreateUser)
                    .HasMaxLength(50)
                    .HasColumnName("create_user");

                entity.Property(e => e.DelFlag)
                    .HasMaxLength(1)
                    .HasColumnName("del_flag")
                    .IsFixedLength(true);

                entity.Property(e => e.DictLabel)
                    .HasMaxLength(100)
                    .HasColumnName("dict_label");

                entity.Property(e => e.DictSort)
                    .HasMaxLength(100)
                    .HasColumnName("dict_sort");

                entity.Property(e => e.DictType)
                    .HasMaxLength(100)
                    .HasColumnName("dict_type");

                entity.Property(e => e.DictValue)
                    .HasMaxLength(100)
                    .HasColumnName("dict_value");

                entity.Property(e => e.IsDefault)
                    .HasMaxLength(1)
                    .HasColumnName("is_default")
                    .IsFixedLength(true);

                entity.Property(e => e.ModifyTime)
                    .HasColumnType("datetime")
                    .HasColumnName("modify_time");

                entity.Property(e => e.ModifyUser)
                    .HasMaxLength(50)
                    .HasColumnName("modify_user");

                entity.Property(e => e.Remark)
                    .HasMaxLength(50)
                    .HasColumnName("remark");

                entity.Property(e => e.Status)
                    .HasMaxLength(1)
                    .HasColumnName("status")
                    .IsFixedLength(true);
            });

            modelBuilder.Entity<User>(entity =>
            {
                entity.ToTable("user");

                entity.Property(e => e.UserId)
                    .HasMaxLength(50)
                    .HasColumnName("user_Id");

                entity.Property(e => e.Address)
                    .HasMaxLength(100)
                    .HasColumnName("address");

                entity.Property(e => e.Avatar)
                    .HasMaxLength(1000)
                    .HasColumnName("avatar");

                entity.Property(e => e.CompanyId)
                    .HasMaxLength(64)
                    .HasColumnName("company_id");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("create_time");

                entity.Property(e => e.CreateUser)
                    .HasMaxLength(200)
                    .HasColumnName("create_user");

                entity.Property(e => e.Delflage)
                    .HasColumnType("int(11)")
                    .HasColumnName("delflage");

                entity.Property(e => e.Email)
                    .HasMaxLength(200)
                    .HasColumnName("email");

                entity.Property(e => e.Integral)
                    .HasColumnType("int(11)")
                    .HasColumnName("integral");

                entity.Property(e => e.LoginDate)
                    .HasColumnType("datetime")
                    .HasColumnName("login_date");

                entity.Property(e => e.LoginFlag)
                    .HasMaxLength(64)
                    .HasColumnName("login_flag");

                entity.Property(e => e.LoginIp)
                    .HasMaxLength(1000)
                    .HasColumnName("login_ip");

                entity.Property(e => e.Mobile)
                    .HasMaxLength(100)
                    .HasColumnName("mobile");

                entity.Property(e => e.OrganizeId)
                    .HasMaxLength(50)
                    .HasColumnName("organize_id");

                entity.Property(e => e.Password)
                    .HasMaxLength(200)
                    .HasColumnName("password");

                entity.Property(e => e.Qrcode)
                    .HasMaxLength(64)
                    .HasColumnName("qrcode");

                entity.Property(e => e.RoleId)
                    .HasMaxLength(50)
                    .HasColumnName("role_Id");

                entity.Property(e => e.Status)
                    .HasMaxLength(1)
                    .HasColumnName("status");

                entity.Property(e => e.UpdateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("update_time");

                entity.Property(e => e.UpdateUser)
                    .HasMaxLength(200)
                    .HasColumnName("update_user");

                entity.Property(e => e.UserCode)
                    .HasMaxLength(100)
                    .HasColumnName("user_code");

                entity.Property(e => e.UserName)
                    .HasMaxLength(200)
                    .HasColumnName("user_name");

                entity.Property(e => e.UserType)
                    .HasMaxLength(64)
                    .HasColumnName("user_type");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
